#include "commonDefine.h"
#include "sysInit.h"
#include "liveMediaRead.h"
#include "protocolServer.h"

#include <unistd.h>
#include <signal.h>


void signalCatch(int sigID){
    INFO_PRT("catch sys signal SIGINT|SIGTERM %d\n",sigID);

    // destory rtsp
    rtsp_server_quit();
//    rtsp_venc_destory_h264(VIS_VPSS_GRP_ID,VIS_VPSS_RTSP_CHN,VIS_VENC_ID);

 //   ss928_sys_destory();
}

void printProcVersion(){
    printf("***************** sys %s *************************\n",SYS_VERSION);
}

int main(int argc, char *argv[])
{
    signal(SIGINT,signalCatch);
    signal(SIGTERM,signalCatch);
    
    printProcVersion();

    int ret = ss928_sys_init();
    if(ret < 0){
        ERRO_PRT("error ss928_sys_init\n");
        return -1;
    }

    
    protocolServer server;
    server.serverInit();
    
    rtsp_venc_init_h264(VIS_VPSS_GRP_ID,VIS_VPSS_RTSP_CHN,VIS_VENC_ID,true);
    
    rtsp_server_run();

    return 0;
}